package com.ai_chat.sys.service.impl;

import com.ai_chat.sys.entity.TokenPackage;
import com.ai_chat.sys.mapper.TokenPackageMapper;
import com.ai_chat.sys.service.ITokenPackageService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class TokenPackageServiceImpl extends ServiceImpl<TokenPackageMapper, TokenPackage> implements ITokenPackageService {

    @Autowired
    private TokenPackageMapper tokenPackageMapper;

    public List<TokenPackage> getAllTokenPackage(){
        LambdaQueryWrapper<TokenPackage> condition = new LambdaQueryWrapper<>();

        return tokenPackageMapper.selectList(condition);
    }

    public TokenPackage getTokenPackageById(Integer id){
        LambdaQueryWrapper<TokenPackage> condition = new LambdaQueryWrapper<>();
        condition.eq(TokenPackage::getId,id);
        return tokenPackageMapper.selectOne(condition);
    }
}
